﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;

namespace TreeBuilder
{
	public abstract class TreeOperationAction : UndoableAction
	{
		protected DottedCanvas Canvas { get; private set; }

		protected TreeOperationAction(DottedCanvas canvas)
		{
			Canvas = canvas;
		}

		protected void AddToTree(UIElement element)
		{
			if (!Canvas.Children.Contains(element))
				Canvas.Children.Add(element);
		}

		protected void RemoveFromTree(UIElement element)
		{
			if (Canvas.Children.Contains(element))
				Canvas.Children.Remove(element);
		}
	}
}
